<div class="my-3 flex">
    <div class="w-1/2">
        <div class="flex">
            <%= img_tag(@organization.logo, class: "mt-2 h-24 w-24 rounded-md") %>
            <div class="mt-2 pl-3">
                <div class="text-xl font-bold text-slate-100 truncate">
                    <%= @organization.name %> - <%= @plan.name %> plan
                    <%= if @organization.stripe_customer_id do %>
                        - <%= link "Stripe", to: StripeSrv.customer_url(@organization.stripe_customer_id), target: "_blank", class: "underline" %>
                    <% end %>
                    <%= if @organization.clever_cloud_resource do %>
                        - <span title={@organization.clever_cloud_resource.owner_name}>Clever Cloud</span>
                    <% end %>
                    <%= if @organization.heroku_resource do %>
                        - <span title={@organization.heroku_resource.name}>Heroku</span>
                    <% end %>
                </div>
                <div class="mt-1 text-xs font-medium text-scheme-yellow truncate">
                    <%= if @organization.is_personal do %>
                        <a href={Routes.admin_user_path(@conn, :show, @organization.created_by)} class="underline">Personal organization</a>
                    <% else %>
                        Created by <a href={Routes.admin_user_path(@conn, :show, @organization.created_by)} class="underline"><%= @organization.created_by.name %></a>
                    <% end %>
                </div>
                <div class="mt-1 text-xs font-medium text-slate-300">
                    <%= if @organization.github_username do %>
                        <a href={"https://github.com/#{@organization.github_username}"} title="GitHub profile" class="underline"><%= @organization.github_username %></a>
                    <% end %>
                    <%= if @organization.twitter_username do %>
                        - <a href={"https://twitter.com/#{@organization.twitter_username}"} title="Twitter account" class="underline">@<%= @organization.twitter_username %></a>
                    <% end %>
                    <%= if @organization.description != nil && @organization.description != "" do %>
                        - <span title="description"><%= @organization.description %></span>
                    <% end %>
                </div>
                <div class="mt-1 text-xs font-medium text-slate-300">
                    Features:
                    <span class={if(@plan.colors, do: "", else: "line-through")}>colors</span>,
                    <span class={if(@plan.aml, do: "", else: "line-through")}>db design</span>,
                    <span class={if(@plan.schema_export, do: "", else: "line-through")}>sql export</span>,
                    <span class={if(@plan.ai, do: "", else: "line-through")}>AI</span>,
                    <span>analysis <%= @plan.analysis %></span>,
                    <span class={if(@plan.project_export, do: "", else: "line-through")}>project export</span>,
                    <%= @plan.projects || "∞" %> projects,
                    <%= @plan.project_dbs || "∞" %> dbs,
                    <%= @plan.project_layouts || "∞" %> layouts (<%= @plan.layout_tables || "∞" %> tables),
                    <%= @plan.project_doc || "∞" %> docs,
                    <span class={if(@plan.project_share, do: "", else: "line-through")}>project share,</span>
                    <span title="update with `seats` metadata in Stripe subsription"><%= @organization.plan_seats %> seats</span>
                    (<%= link "refresh plan", to: Routes.admin_organization_path(@conn, :refresh, @organization.id), method: :post, title: "Refresh this organization if its plan is out of sync.", class: "underline" %>)
                </div>
                <%= if @organization.data do %>
                <div class="mt-1 text-xs font-medium text-slate-500 truncate">Data: <%= @organization.data |> format_data() %></div>
                <% end %>
            </div>
        </div>
        <div class="my-3"><%= render AzimuttWeb.Admin.ProjectView, "_projects_table.html", conn: @conn, projects: @projects %></div>
        <div class="my-3"><%= render AzimuttWeb.Admin.UserView, "_users_table.html", conn: @conn, users: @members %></div>
        <%= if @invitations.items |> length() > 0 do %>
            <div class="my-3"><%= render "_invitations_table.html", conn: @conn, now: @now, invitations: @invitations %></div>
        <% end %>
        <div class="my-3"><canvas class="line-chart"><%= @activity |> Jason.encode!() %></canvas></div>
    </div>
    <div class="pl-3 w-1/2">
        <%= render AzimuttWeb.Admin.EventView, "_events_table.html", conn: @conn, events: @events %>
    </div>
</div>
